﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="unauditeditemview.aspx.cs"
    Inherits="Admin_unauditeditemview" Theme="Admin_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>

    <script type="text/javascript">
        function $(id) {
            return document.getElementById(id);
        }
        function ResetPage() {
            $('itemFrame').setAttribute("src", "");
            $('itemFrame').style.display = 'none';
            $('loadingState').style.display = 'none';
        }
        function RefreshPage() {
            window.location.replace(document.getElementById('localHref').value);
        }
        function ShowFrame() {
            if ($('itemFrame').style.display == 'none') {
                $('itemFrame').style.display = '';
                $('loadingState').style.display = '';
            } else {
            }
        }
        function HideLoadingState() {
            $('loadingState').style.display = 'none';
        }
        function FrameLoaded() {
            HideLoadingState();
            var ifrm = document.getElementById('itemFrame');
            var height_doc = parseInt(ifrm.contentWindow.document.body.scrollHeight);
            var height_parnent = parseInt(ifrm.parentNode.offsetHeight);
            if (height_doc > height_parnent) {
                ifrm.style.height = height_doc + 'px';
            } else {
                ifrm.style.height = height_parnent + 'px';
            }
        }

        /*********** 全选、批量删除、批量通过审核（开始）  *************/
        var selected = false;
        function SelectAllItems() {
            var ckLisk = document.getElementsByName("selectItem");
            if (selected == false) {
                for (var i = 0; i < ckLisk.length; i++) {
                    ckLisk[i].checked = true;
                }
                $('btnSelectAll').value = "取消全选";
            }
            else {
                for (var i = 0; i < ckLisk.length; i++) {
                    ckLisk[i].checked = '';
                }
                $('btnSelectAll').value = "全选";
            }
            selected = !selected;
        }
        function BatchDeleteItems() {
            var ckLisk = document.getElementsByName("selectItem");
            var idList = '';
            for (var i = 0; i < ckLisk.length; i++) {
                if (ckLisk[i].checked == true) {
                    idList += ckLisk[i].value + ",";
                }
            }
            if (idList.length == 0) {
                alert('没有选择条目');
            } else {
                if (window.confirm('确认删除所选条目吗？')) {
                    $('itemFrame').setAttribute("src", "item.aspx?action=batchdelete&itemId=" + idList);
                    ShowFrame();
                }
            }
        }
        function BatchCheckedItems() {
            var ckLisk = document.getElementsByName("selectItem");
            var idList = '';
            for (var i = 0; i < ckLisk.length; i++) {
                if (ckLisk[i].checked == true) {
                    idList += ckLisk[i].value + ",";
                }
            }
            if (idList.length == 0) {
                alert('没有选择条目');
            } else {
                if (window.confirm('确认设置所选条目为通过审核吗？')) {
                    $('itemFrame').setAttribute("src", "item.aspx?action=batchchecked&itemId=" + idList);
                    ShowFrame();
                }
            }
        }
        /*********** 全选、批量删除（结束）  *************/
        function QuickModify(url) {
            var idvalue = $('tb_quick_itemId').value;
            try {
                var id = parseInt(idvalue);
                if (id > 0) {
                    document.location.href = url + id;
                } else {
                    alert("请输入正确的ID.");
                }
            } catch (e) {
                alert("请输入正确的ID.");
            }
        }
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div class="container">
        <div class="pageheader">
            <b style="color: Red">未审核<%= Resources.Resource.Item %>管理</b>
        </div>
        <asp:Repeater ID="rptItems" runat="server">
            <HeaderTemplate>
                <table>
                    <col width="10%" />
                    <col width="50%" />
                    <col width="15%" />
                    <col width="15%" />
                    <col width="10%" />
                    <tr>
                        <th>
                            ID
                        </th>
                        <th>
                            <% =Resources.Resource.ResourceManager.GetString("ItemTitle")%>
                        </th>
                        <th>
                            <% =Resources.Resource.ResourceManager.GetString("ItemAuthorName")%>
                        </th>
                        <th>
                            <% =Resources.Resource.ResourceManager.GetString("ItemAddDate")%>
                        </th>
                        <th>
                            管理操作
                        </th>
                    </tr>
            </HeaderTemplate>
            <ItemTemplate>
                <tr class='<%# Container.ItemIndex%2==0? "tr_bg":"" %>'>
                    <td>
                        <input type="checkbox" name="selectItem" value="<%# Eval("ItemId") %>" />
                        <%# Eval("ItemId") %>
                    </td>
                    <td>
                        <%# Eval("Title") %>
                    </td>
                    <td>
                        <%# Eval("AuthorName")%>
                    </td>
                    <td>
                        <%# Eval("AddDate","{0:yy-MM-dd hh:mm}")%>
                    </td>
                    <td>
                        <%--<a title="推荐" href="item.aspx?itemId=<%# Eval("ItemId") %>&action=recommand&isrecommand=<%# Eval("IsRecommend") %>" target="itemFrame">推荐/取消</a>--%>
                        <a title="编辑" href="item.aspx?itemId=<%# Eval("ItemId") %>&action=modify&from=<% =this.PageBreak.GetCurrentPageUrl() %>">
                            编辑</a> <a title="删除" onclick="return(window.confirm('确认删除该条目吗？'));" href="item.aspx?itemId=<%# Eval("ItemId") %>&action=delete"
                                target="itemFrame">删除</a>
                    </td>
                </tr>
            </ItemTemplate>
            <FooterTemplate>
                <tr>
                    <td colspan="5">
                        <center>
                            <input id="btnSelectAll" type="button" onclick="SelectAllItems();" value="全选" class="input_Button" />
                            &nbsp; &nbsp;
                            <input type="button" onclick="BatchDeleteItems();" value="删除所选" class="input_Button" />
                            &nbsp; &nbsp;
                            <input type="button" onclick="BatchCheckedItems();" value="通过审核" class="input_Button" />
                        </center>
                    </td>
                </tr>
                </table></FooterTemplate>
        </asp:Repeater>
        <Admin:PageBreak runat="server" ID="PageBreak" />
        <div id="loadingState" style="display: none;">
        </div>
        <iframe id="itemFrame" name="itemFrame" frameborder="0" style="display: none;" onload="FrameLoaded();">
        </iframe>

        <script type="text/javascript">
            var links = document.getElementsByTagName("A");
            for (var i = 0; i < links.length; i++) {
                if (links[i].getAttribute("target") == $('itemFrame').getAttribute("name")) {
                    if (links[i].onclick == null) {
                        links[i].onclick = ShowFrame;
                    } else {
                    }
                }
            }
            function NavUrl(url) {
                document.location.href = url;
            }
        </script>

    </div>
    </form>
</body>
</html>
